package com.as.server.service.Impl;

import com.as.server.entity.Collection;
import com.as.server.mapper.CollectionMapper;
import com.as.server.service.CollectionService;
import javafx.print.Collation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Set;

@Service
public class CollectionServiceImpl implements CollectionService {
    @Autowired
    private CollectionMapper mapper;

    @Autowired
    private RedisTemplate redisTemplate;



    @Override
    public Boolean insert(Collection record) {
        //根据uid 进行模糊查询把相关分页缓存清掉
        Set<String> keys = redisTemplate.keys("FollowSpace*"+record.getUid()+"*");
        redisTemplate.delete(keys);
        return (mapper.insert(record)) > 0;
    }
}
